// 全局样式变量
:root {
  --primary-color: #1890ff;
  --success-color: #52c41a;
  --warning-color: #faad14;
  --error-color: #f5222d;
  --text-color: #262626;
  --text-color-secondary: #8c8c8c;
  --background-color: #f5f5f5;
  --border-color: #d9d9d9;
  --sidebar-width: 280px;
}

body.dark-theme {
  --background-color: #181c20;
  --text-color: #eee;
  --text-color-secondary: #aaa;
  --primary-color: #23272e;
  --sidebar-width: 280px;
  --card-bg: #23272e;
  --sidebar-bg: #181c20;
  --sidebar-header-bg: #23272e;
  --sidebar-border: #222;
  --sidebar-active-bg: #40a9ff;
  --sidebar-hover-bg: #222;
  --sidebar-text: #eee;
  --sidebar-active-text: #fff;
  --sidebar-hover-text: #40a9ff;
  --border-color: #222;
  background: #181818 !important;
  color: #eee !important;
  --main-text-color: #e6e6e6;
  --main-title-color: #fff;
  --main-secondary-color: #aaa;
  --el-border-color: #333;
  --el-table-header-bg: #23272e;
  --el-table-row-bg: #23272e;
  --el-table-row-alt-bg: #20232a;
  --el-button-bg: #40a9ff;
  --el-button-text: #fff;
  --el-tag-bg: #23272e;
  --el-tag-text: #40a9ff;
}

body.dark-theme .main-container,
body.dark-theme .main-container .card,
body.dark-theme .main-container .card-header,
body.dark-theme .main-container .el-descriptions,
body.dark-theme .main-container .el-tag,
body.dark-theme .main-container .el-button {
  color: var(--main-text-color) !important;
}
body.dark-theme .main-container .card-header,
body.dark-theme .main-container .el-descriptions__title,
body.dark-theme .main-container .el-descriptions__label {
  color: var(--main-title-color) !important;
  font-weight: bold;
}

// 全局重置样式
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-color);
  background-color: var(--background-color);
}

#app {
  height: 100%;
}

// 布局样式
.app-container {
  min-height: 100vh;
  background: var(--background-color);
  padding-top: var(--header-height); /* 为固定头部留出空间 */
}

.main-container {
  min-height: calc(100vh - var(--header-height));
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

// 头部样式
.app-header {
  height: var(--header-height);
  background: linear-gradient(135deg, var(--primary-color) 0%, #40a9ff 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  
  .header-left {
    display: flex;
    align-items: center;
    
    .logo {
      font-size: 20px;
      font-weight: bold;
      margin-right: 20px;
    }
    
    .nav-menu {
      display: flex;
      list-style: none;
      
      .nav-item {
        margin: 0 15px;
        cursor: pointer;
        padding: 8px 16px;
        border-radius: 4px;
        transition: background-color 0.3s;
        
        &:hover {
          background-color: rgba(255, 255, 255, 0.1);
        }
        
        &.active {
          background-color: rgba(255, 255, 255, 0.2);
        }
      }
    }
  }
  
  .header-right {
    display: flex;
    align-items: center;
    
    .user-info {
      display: flex;
      align-items: center;
      cursor: pointer;
      padding: 8px 12px;
      border-radius: 4px;
      transition: background-color 0.3s;
      
      &:hover {
        background-color: rgba(255, 255, 255, 0.1);
      }
      
      .avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        margin-right: 8px;
        background-color: rgba(255, 255, 255, 0.2);
      }
      
      .username {
        margin-right: 8px;
      }
    }
  }
}

// 卡片样式
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 20px;
  
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    
    .card-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-color);
    }
  }
  
  .card-content {
    color: var(--text-color-secondary);
  }
}

// 按钮样式
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  text-decoration: none;
  
  &.btn-primary {
    background-color: var(--primary-color);
    color: white;
    
    &:hover {
      background-color: #40a9ff;
    }
  }
  
  &.btn-success {
    background-color: var(--success-color);
    color: white;
    
    &:hover {
      background-color: #73d13d;
    }
  }
  
  &.btn-warning {
    background-color: var(--warning-color);
    color: white;
    
    &:hover {
      background-color: #ffc53d;
    }
  }
  
  &.btn-danger {
    background-color: var(--error-color);
    color: white;
    
    &:hover {
      background-color: #ff4d4f;
    }
  }
}

// 表格样式
.table {
  width: 100%;
  border-collapse: collapse;
  
  th, td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
  }
  
  th {
    background-color: #fafafa;
    font-weight: 600;
  }
  
  tr:hover {
    background-color: #f5f5f5;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .app-header {
    .header-left {
      .nav-menu {
        display: none;
      }
    }
  }
  
  .main-container {
    padding: 10px;
  }
  
  .card {
    padding: 16px;
  }
}

// 动画效果
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.3s;
}

.fade-enter, .fade-leave-to {
  opacity: 0;
}

.slide-enter-active, .slide-leave-active {
  transition: transform 0.3s;
}

.slide-enter, .slide-leave-to {
  transform: translateX(-100%);
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 通用样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
}

.page-description {
  color: var(--text-color-secondary);
  font-size: 14px;
}

/* 按钮样式 */
.btn-group {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

/* 表格样式 */
.table-container {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 表单样式 */
.form-container {
  max-width: 600px;
  margin: 0 auto;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* 状态标签 */
.status-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-success {
  background: #f6ffed;
  color: var(--success-color);
  border: 1px solid #b7eb8f;
}

.status-warning {
  background: #fffbe6;
  color: var(--warning-color);
  border: 1px solid #ffe58f;
}

.status-error {
  background: #fff2f0;
  color: var(--error-color);
  border: 1px solid #ffccc7;
}

.status-info {
  background: #e6f7ff;
  color: var(--primary-color);
  border: 1px solid #91d5ff;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .card {
    padding: 16px;
  }
  
  .page-title {
    font-size: 20px;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .form-actions {
    flex-direction: column;
  }
}

/* 动画效果 */
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.3s;
}

.fade-enter, .fade-leave-to {
  opacity: 0;
}

.slide-enter-active, .slide-leave-active {
  transition: transform 0.3s;
}

.slide-enter, .slide-leave-to {
  transform: translateX(-100%);
}

/* 工具类 */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-column {
  flex-direction: column;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

/* 处理 ResizeObserver 错误 */
* {
  box-sizing: border-box;
}

/* 减少不必要的重排 */
.el-table,
.el-form,
.el-dialog,
.el-drawer {
  contain: layout style paint;
}

/* 优化动画性能 */
.el-fade-in-linear,
.el-fade-in-linear-enter-active,
.el-fade-in-linear-leave-active {
  will-change: opacity;
}

.el-zoom-in-center,
.el-zoom-in-center-enter-active,
.el-zoom-in-center-leave-active {
  will-change: transform, opacity;
}

body.dark-theme .main-container {
  background: var(--background-color) !important;
  color: var(--main-text-color) !important;
}
body.dark-theme .card,
body.dark-theme .account-info-card {
  background: #111 !important;
  color: #fff !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  border: 1.5px solid #23272e;
  border-radius: 18px;
  margin-bottom: 32px;
  padding: 28px 28px 20px 28px;
}
body.dark-theme .main-container > .card,
body.dark-theme .main-container > .account-info-card {
  margin-bottom: 36px;
}
body.dark-theme .card-header,
body.dark-theme .main-container .card-header,
body.dark-theme .account-info-card .account-details h4 {
  background: #111 !important;
  color: #fff !important;
  font-weight: bold;
}
body.dark-theme .el-descriptions,
body.dark-theme .account-info-card .el-descriptions {
  background: #181c20 !important;
  color: #fff !important;
  border-radius: 10px;
  border: 1.5px solid #23272e !important;
  margin-bottom: 0;
}
body.dark-theme .el-descriptions__label,
body.dark-theme .account-info-card .el-descriptions__label {
  color: #aaa !important;
  background: #181c20 !important;
  font-weight: 500;
  border-right: 1px solid #23272e !important;
}
body.dark-theme .el-descriptions__cell,
body.dark-theme .account-info-card .el-descriptions__cell {
  color: #fff !important;
  background: #181c20 !important;
  border-right: 1px solid #23272e !important;
}
body.dark-theme .el-descriptions__row {
  border-bottom: 1px solid #23272e !important;
}
body.dark-theme .el-descriptions__row:last-child {
  border-bottom: none !important;
}
body.dark-theme .main-container h3,
body.dark-theme .main-container h4,
body.dark-theme .main-container .card-title {
  color: var(--main-title-color) !important;
  font-weight: bold;
}
body.dark-theme .main-container .el-tag {
  background: var(--el-tag-bg) !important;
  color: var(--el-tag-text) !important;
  border: 1px solid var(--el-tag-text) !important;
}
body.dark-theme .main-container .el-button {
  background: var(--el-button-bg) !important;
  color: var(--el-button-text) !important;
  border: none !important;
}
body.dark-theme .main-container .el-button:hover {
  background: #69c0ff !important;
  color: #23272e !important;
}
body.dark-theme .main-container .el-input__inner,
body.dark-theme .main-container .el-select__inner {
  background: #23272e !important;
  color: #fff !important;
  border: 1px solid var(--el-border-color) !important;
}
body.dark-theme .main-container .el-divider__text {
  color: var(--main-title-color) !important;
} 